VERSION 5.00
Begin VB.Form frmFind 
   Caption         =   "Procurar texto"
   ClientHeight    =   2085
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4770
   Icon            =   "frmFind.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   2085
   ScaleWidth      =   4770
   StartUpPosition =   3  'Windows Default
   Begin VB.CheckBox chkAll 
      Caption         =   "Procurar em todos"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   1200
      Width           =   1935
   End
   Begin VB.Frame fraFind 
      Height          =   1455
      Left            =   120
      TabIndex        =   2
      Top             =   600
      Width           =   2295
      Begin VB.CheckBox chkSame 
         Caption         =   "Procurar igual"
         Height          =   375
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   1935
      End
   End
   Begin VB.TextBox txtFind 
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   120
      Width           =   3135
   End
   Begin VB.CommandButton btFind 
      Caption         =   "&Procurar"
      Height          =   375
      Left            =   3360
      TabIndex        =   0
      Top             =   120
      Width           =   1095
   End
End
Attribute VB_Name = "frmFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub btFind_Click()
'Dim indexToText As Integer
'Dim returnValue As Boolean
'
'    returnValue = False
'
'    If Len(txtFind.Text) > 0 Then
'        ' Obtain the location of the search string in richTextBox1.
'        indexToText = fMainForm.ActiveForm.rtfTexto.Find(txtFind.Text)
'        ' Determine whether the text was found in richTextBox1.
'        If indexToText >= 0 Then
'            returnValue = True
'        End If
'    End If
'
'    MsgBox returnValue
Dim pos As Integer
    
    If Len(txtFind.Text) > 0 Then
        pos = fMainForm.ActiveForm.rtfTexto.SelStart
        pos = InStr(pos + 2, fMainForm.ActiveForm.rtfTexto.Text, txtFind.Text)
        If pos = 0 Then
        fMainForm.ActiveForm.rtfTexto.SelStart = 0
        fMainForm.ActiveForm.rtfTexto.SelLength = 0
        MsgBox "entrou no IF"
        Else
        fMainForm.ActiveForm.rtfTexto.SelStart = pos - 1
        fMainForm.ActiveForm.rtfTexto.SelLength = Len(txtFind.Text)
        MsgBox "entrou no Else"
        End If
    
        fMainForm.ActiveForm.rtfTexto.SetFocus
    End If
    

End Sub

